public class MyBinaryTree {
    static class TreeNode{
        int val;
        TreeNode left;
        TreeNode right;

        public TreeNode(int val){
            this.val=val;
        }
    }
    public TreeNode root;
    public static TreeNode find(TreeNode root, int val) {
        if (root == null) {
            return null;
        }
        if (root.val == val) {
            return root;
        }
        TreeNode left= find(root.left,val);
        if(left != null){
            return left;
        }
        TreeNode right = find(root.right,val);
        if(right != null){
            return right;
        }
        return null;
    }
        public boolean isSymmetric(TreeNode root) {
            if(root == null){
                return true;
            }
            return isSymmetricChild(root.left,root.right);
        }
        public boolean isSymmetricChild(TreeNode leftTree,TreeNode rightTree){
            if((leftTree == null &&rightTree != null)||(leftTree != null && rightTree == null)){
                return false;
            }
            if(leftTree == null && rightTree == null){
                return true;
            }
            if(leftTree.val != rightTree.val){
                return false;
            }
            return isSymmetricChild(leftTree.right,rightTree.left)
                    &&isSymmetricChild(leftTree.left,rightTree.right);
        }
}

